/**
 * 
 */
package com.taobao.service;

import java.util.List;

import com.taobao.client.obj.TopItem;
import com.taobao.client.obj.TopRefund;
import com.taobao.client.obj.TopTrade;

/**
 * Provide services about trades
 * 
 * @author hujingfei.pt@taobao.com
 *
 */
public interface TradeService {
	/**
	 * Get a list of trades as a seller
	 * 
	 * @param sessionid the session id(key)
	 * @param nick the nickname of the seller
	 * @return a list of trades
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public List<TopTrade> tradeSoldGet(String nick) throws Exception;
	
	/**
	 * Get a list of trades as a buyer
	 * 
	 * @param nick the nickname of the buyer
	 * @return a list of trades
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public List<TopTrade> tradeBoughtGet(String nick) throws Exception;
	
	/** 
	 * Create a trade between the buyer and the seller
	 * 
	 * @param item the item covered in the trade
	 * @param buyer the nickname of the buyer
	 * @param seller the nickname of the seller
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public void addTrade(List<TopItem> item,String buyer, String seller, String name, String phone, String mobile, String province,
			String city, String area, String division_code, String post_code, String address_detail, boolean isNewAddress, String memo,
			String discount)throws Exception;
	
	/**
	 * Seller sends the item
	 * 
	 * @param tid the id of the trade
	 * @throws Exception Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public void deliverySend(String tid) throws Exception;
	
	/**
	 * Get the refunds the buyer applied
	 * 
	 * @param nick the nickname of the buyer
	 * @return a list of refunds
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public List<TopRefund> getBuyerRefunds(String nick)	throws Exception;
	
	/**
	 * Get the refunds the seller received
	 * 
	 * @param seller the nickname of the seller
	 * @return a list of refunds
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public List<TopRefund> getSellerRefund(String seller) throws Exception;
	
	/**
	 * Get the items of the seller
	 * 
	 * @param nick the nickname of the seller
	 * @return a list of items
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	public List<TopItem> itemsGet(String nick) throws Exception;
	
	/**
	 * Get the concrete information of the refund
	 * 
	 * @param refundId the id of the refund.
	 * @return a refund object.
	 * @throws Exception when some services behind back-end is unavailable, throw exceptions
	 */
	TopRefund getRefundInfo(String refundId) throws Exception;
}
